import sys, os, cv2, datetime
from PyQt5.QtCore import Qt, QTimer, QThread, pyqtSignal, QDate, QTime
from PyQt5.QtGui import QImage, QPixmap, QFont
from PyQt5.QtWidgets import (
    QApplication, QMainWindow, QWidget, QLabel, QPushButton,
    QVBoxLayout, QHBoxLayout, QMessageBox, QInputDialog, QLineEdit,
    QTableWidget, QTableWidgetItem, QDateEdit, QDialog, QGroupBox,
    QFormLayout, QTimeEdit, QDialogButtonBox
)

# 复用原业务逻辑
sys.path.append(os.path.dirname(__file__))
from util import camera
from util import public_tools as tool
from service import hr_service as hr

class LoginDialog(QDialog):
    """管理员登录弹窗"""
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("管理员登录")
        self.user = QLineEdit()
        self.pwd = QLineEdit(); self.pwd.setEchoMode(QLineEdit.Password)
        form = QFormLayout(self)
        form.addRow("账号:", self.user)
        form.addRow("密码:", self.pwd)
        btn = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        form.addRow(btn)
        btn.accepted.connect(self.accept)
        btn.rejected.connect(self.reject)
        self.setFixedSize(300, 150)

    def get_result(self):
        return self.user.text().strip(), self.pwd.text().strip()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = LoginDialog()
    w.show()
    sys.exit(app.exec_())
